import React, {Component} from 'react';
import {NavLink} from "react-router-dom";
import JumpBtns from "../clickJunpRoute";

export default class Menu extends Component {

    computedClass=(e)=>{
        return e.isActive? 'activeStyle':'inactiveStyle'
    }
    render() {
        return (
            <div className='menu'>
                <JumpBtns></JumpBtns>
                {/*一般跳转都是push入栈 replace会替换当前路由*/}
                <NavLink replace to={`/home/${'params传参123'}`} className={(e)=>this.computedClass(e)}>param传参</NavLink>
                <NavLink to='/about?name=xxx&&age=5' className={(e)=>this.computedClass(e)}>Search传参</NavLink>
                <NavLink to={{pathname:'/other',state:{name:'xxx',age:5}}} className={(e)=>this.computedClass(e)}>state传参</NavLink>
            </div>
        );
    }
}
